<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>四角箭头包裹效果</title>
    <style>
        body {
            margin: 0;
            padding: 40px;
            background-color: #1a1a1a;
            font-family: Arial, sans-serif;
        }

        .container {
            width: 400px;
            height: 300px;
            background-color: #2a2a2a;
            position: relative;
            margin: 50px auto;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 18px;
        }

        /* 四角箭头包裹效果 */
        .arrow-wrapper {
            position: relative;
        }

        .arrow-wrapper::before,
        .arrow-wrapper::after {
            content: '';
            position: absolute;
            width: 30px;
            height: 30px;
        }

        /* 左上角箭头 */
        .arrow-wrapper::before {
            top: -1px;
            left: -1px;
            border-top: 2px solid #f44;
            border-left: 2px solid #f33;
        }

        /* 右上角箭头 */
        .arrow-wrapper::after {
            top: -1px;
            right: -1px;
            border-top: 2px solid #f33;
            border-right: 2px solid #f33;
        }

        /* 左下角和右下角箭头需要额外的伪元素 */
        .arrow-wrapper {
            position: relative;
        }

        .arrow-wrapper .corner-bottom-left,
        .arrow-wrapper .corner-bottom-right {
            position: absolute;
            width: 30px;
            height: 30px;
            content: '';
        }

        /* 左下角箭头 */
        .corner-bottom-left {
            bottom: -1px;
            left: -1px;
            border-left: 2px solid #f33;
            border-bottom: 2px solid #f33;
        }

        /* 右下角箭头 */
        .corner-bottom-right {
            bottom: -1px;
            right: -1px;
            border-right: 2px solid #f33;
            border-bottom: 2px solid #f33;
        }

        /* 方法二：使用单个div实现所有四角 */
        .method2 {
            margin-top: 80px;
        }

        .simple-arrow-wrapper {
            position: relative;
            width: 400px;
            height: 300px;
            background-color: #2a2a2a;
            margin: 0 auto;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 18px;
        }

        .simple-arrow-wrapper::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: 
                linear-gradient(to right, #f44 30px, transparent 30px) top left,
                linear-gradient(to bottom, #f33 30px, transparent 30px) top left,
                linear-gradient(to left, #f33 30px, transparent 30px) top right,
                linear-gradient(to bottom, #f33 30px, transparent 30px) top right,
                linear-gradient(to right, #f33 30px, transparent 30px) bottom left,
                linear-gradient(to top, #f33 30px, transparent 30px) bottom left,
                linear-gradient(to left, #f33 30px, transparent 30px) bottom right,
                linear-gradient(to top, #f33 30px, transparent 30px) bottom right;
            background-size: 30px 2px, 2px 30px, 30px 2px, 2px 30px, 30px 2px, 2px 30px, 30px 2px, 2px 30px;
            background-repeat: no-repeat;
            pointer-events: none;
        }

        /* 方法三：使用Tailwind CSS类似的方式 */
        .method3 {
            margin-top: 80px;
        }

        .tailwind-style {
            position: relative;
            width: 400px;
            height: 300px;
            background-color: #2a2a2a;
            margin: 0 auto;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 18px;
        }

        /* 使用四个独立的div来实现箭头 */
        .corner {
            position: absolute;
            width: 30px;
            height: 30px;
        }

        .corner-tl {
            top: 0;
            left: 0;
            border-top: 2px solid #f44;
            border-left: 2px solid #f33;
        }

        .corner-tr {
            top: 0;
            right: 0;
            border-top: 2px solid #f33;
            border-right: 2px solid #f33;
        }

        .corner-bl {
            bottom: 0;
            left: 0;
            border-left: 2px solid #f33;
            border-bottom: 2px solid #f33;
        }

        .corner-br {
            bottom: 0;
            right: 0;
            border-right: 2px solid #f33;
            border-bottom: 2px solid #f33;
        }

        .title {
            color: #fff;
            text-align: center;
            margin-bottom: 20px;
            font-size: 24px;
            font-weight: bold;
        }

        .method-title {
            color: #f33;
            font-size: 20px;
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
    <div class="title">四角箭头包裹效果实现方案</div>
    
    <!-- 方法一：使用伪元素和额外div -->    
    <div class="method-title">方法一：使用伪元素 + 额外div元素</div>
    <div class="container arrow-wrapper">
        <div class="corner-bottom-left"></div>
        <div class="corner-bottom-right"></div>
        内容区域 - 方法一
    </div>

    <!-- 方法二：使用背景渐变（推荐） -->
    <div class="method2">
        <div class="method-title">方法二：使用CSS背景渐变（推荐）</div>
        <div class="simple-arrow-wrapper">
            内容区域 - 方法二
        </div>
    </div>

    <!-- 方法三：使用四个独立div（最直观） -->
    <div class="method3">
        <div class="method-title">方法三：使用四个独立div元素（最直观）</div>
        <div class="tailwind-style">
            <div class="corner corner-tl"></div>
            <div class="corner corner-tr"></div>
            <div class="corner corner-bl"></div>
            <div class="corner corner-br"></div>
            内容区域 - 方法三
        </div>
    </div>

    <div style="color: #fff; text-align: center; margin-top: 50px; font-size: 14px;">
        <p>三种实现方案对比：</p>
        <p>方法一：需要额外的div元素，但兼容性好</p>
        <p>方法二：纯CSS实现，代码简洁，推荐使用</p>
        <p>方法三：最直观易懂，便于维护和修改</p>
    </div>
</body>
</html>